package utils

import (
	"bytes"
	"sync"
	"unsafe"
)

// 字符串转化成字节数组
func UnsafeString2Byte(str string) []byte {
	return *(*[]byte)(unsafe.Pointer(&str))
}

// 字节数组转化成字符串
func UnsafeByte2String(b []byte) string {

	return *(*string)(unsafe.Pointer(&b))
}

var BytePool = sync.Pool{
	New: func() interface{} {
		b := make([]byte, 0, 1024)
		return bytes.NewBuffer(b)
	},
}
